package oakclub.cronjob;

import it.sauronsoftware.cron4j.Task;
import it.sauronsoftware.cron4j.TaskExecutionContext;
import oakclub.global.Container;
import oakclub.model.MutualMatchModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SyncMutualMatchWithChatListJob extends Task
{
    public static String schedulingPattern = "0 3 * * *";
    private final Logger logger = LoggerFactory.getLogger(SyncMutualMatchWithChatListJob.class);

    public void execute(TaskExecutionContext context)
    {
        this.logger.info("SyncMutualMatchWithChatListJob");

        MutualMatchModel mutualMatchModel = (MutualMatchModel) Container.getComponent(MutualMatchModel.class);
        try
        {
            mutualMatchModel.syncWithChatList();
        }
        catch(Exception e)
        {
            this.logger.warn("SyncMutualMatchWithChatListJob", e);
        }
    }
}
